﻿using System;
using System.Collections.Generic;
using System.Text;

namespace MyGrid.Core.HexTypeA.Visual
{
    ///<summary>六边形类型可视化信息相关内容。</summary>
    public class HexTypeAVisual
    {
        ///<summary>获得六边形中心的六个顶点。</summary>
        public static MGVector2F[] GetVertexs(MGVector2F shapeCenter, float finalUnitSize)
        {
            var array = new MGVector2F[HexTypeADirectionExtension.DirectionCount];
            array[0] = //左上角
                new MGVector2F(shapeCenter.X - MathExtensions.HalfSqrt3 * finalUnitSize,
                               shapeCenter.Y - 1f / 2f * finalUnitSize);

            array[1] = // 正上方
               new MGVector2F(shapeCenter.X - 0 * finalUnitSize,
               shapeCenter.Y - 1 * finalUnitSize);

            array[2] = // 右上角
                new MGVector2F(shapeCenter.X + MathExtensions.HalfSqrt3 * finalUnitSize,
                               shapeCenter.Y - 1f / 2f * finalUnitSize);

            array[3] = // 右下角
                new MGVector2F(shapeCenter.X + MathExtensions.HalfSqrt3 * finalUnitSize,
                               shapeCenter.Y + 1f / 2f * finalUnitSize);

            array[4] = // 正下方
             new MGVector2F(shapeCenter.X - 0 * finalUnitSize,
             shapeCenter.Y + 1 * finalUnitSize);

            array[5] = // 左下方
                new MGVector2F(shapeCenter.X - MathExtensions.HalfSqrt3 * finalUnitSize,
                               shapeCenter.Y + 1f / 2f * finalUnitSize);

            return array;
        }
    }
}
